import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    name: 'Home',
    path: '/home',
    component: () => import('@/views/Home.vue'),
    meta: {
      title: '首页',
      requireAuth: false
    }
  },
  {
    name: 'OnlineBooking',
    path: '/online-booking',
    component: () => import('@/views/OnlineBooking.vue'),
    meta: {
      title: '线上预约',
      requireAuth: true
    }
  },
  {
    name: 'MyOrder',
    path: '/my-order',
    component: () => import('@/views/MyOrder.vue'),
    meta: {
      title: '我的订单',
      requireAuth: true
    }
  },
  {
    name: 'OrderDetail',
    path: '/order-detail',
    component: () => import('@/views/OrderDetail.vue'),
    meta: {
      title: '订单详情',
      requireAuth: true
    }
  },
  {
    name: 'MyAddress',
    path: '/my-address',
    component: () => import('@/views/MyAddress.vue'),
    meta: {
      title: '我的地址',
      requireAuth: true
    }
  },
  {
    name: 'AddressList',
    path: '/address-list',
    component: () => import('@/views/AddressList.vue'),
    meta: {
      title: '选择地址',
      requireAuth: true
    }
  },
  {
    name: 'AddAddress',
    path: '/add-address',
    component: () => import('@/views/AddAddress.vue'),
    meta: {
      title: '选择地址',
      requireAuth: true
    }
  }
]

const router = new VueRouter({
  routes
})

export default router
